<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<script type="text/javascript" src="my.js"></script>
<script type="text/javascript">
function change1(val,obj){

    if(val=='over'){
		obj.style.color="red";
		obj.style.cursor="hand";
		
		}else if(val=='out'){
				obj.style.color="black";
			}

}
			//相应点击新的聊天窗口
			function openChatRoom(obj){

				//打开新窗口
				//因为window.open是get方式提交，所以到服务器后变成乱码
				//所以需要编码
				window.open("chatRoom.php?username="+encodeURI(obj.innerText),"_blank");

				}


</script>
</head>
<h1>好友列表</h1>
<ul>
<li onmouseover="change1('over',this)" onclick="openChatRoom(this)" onmouseout="change1('out',this)">张三</li>
<li onmouseover="change1('over',this)" onclick="openChatRoom(this)" onmouseout="change1('out',this)">李四</li>
<li onmouseover="change1('over',this)" onclick="openChatRoom(this)" onmouseout="change1('out',this)">王五</li>
</ul>
</form>
</html>